package com.shop.feignClient;

import com.shop.feignClient.fallbackFactory.AliyunFallback;
import com.shop.po.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 'banxia'
 * @version 1.0
 * @description Aliyun
 * @date 2023/2/23 15:48
 */
@FeignClient(value = "shopping-aliyun",configuration = MultipartSupportConfig.class,
            fallbackFactory = AliyunFallback.class)
@CrossOrigin
//@RequestMapping("")
public interface AliyunClient {

    //上传头像
//    @Headers(value={"Content-Type: multipart/form-data","accept: application/json;charset=UTF-8"})
    @PostMapping(value = "/aliyun/oss/upload", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
    public R uploadOssFile(@RequestPart("file") MultipartFile file, @RequestParam("path") String path);

    //发送短信（商家注册的时候发送的短信）
    @GetMapping(value = "/aliyun/sms/send/mer/{redisKey}/{phone}")
    public R sendMessage(@PathVariable("redisKey") String redisKey, @PathVariable("phone") String phone);

}
